<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // 获取距离1970年的毫秒数，即时间戳
        // 1. valueOf() getTime()
        var date = new Date();
        console.log(date.valueOf());
        console.log(date.getTime());
        // 2.简单写法(最常用的写法)
        var date1 = +new Date();
        console.log(date1);
        // 3.H5新增的方法
        console.log(Date.now());
    </script>
</head>

<body>

</body>

</html>